//
//  DemoDicSort.swift
//  swiftDemo
//
//  Created by JIENING ZHANG on 2020/1/8.
//  Copyright © 2020 lovivid. All rights reserved.
//

import UIKit

class DemoDicSort: NSObject {
    class func demoLogic() {
        let monthDic : [String : Int] = [
            "January" :     31,
            "February" :    28,
            "March" :       31,
            "April" :       30,
            "May" :         31,
            "June" :        30,
            "July" :        31,
            "August" :      31,
            "September" :   30,
            "October" :     31,
            "November" :    30,
            "December" :    31,
        ];
        
        for key in monthDic.keys.sorted() {
            print("DemoDicSort, key=\(key), value=\(monthDic[key] ?? 0)")
        }
/*
输出:
         
DemoDicSort, key=April, value=30
DemoDicSort, key=August, value=31
DemoDicSort, key=December, value=31
DemoDicSort, key=February, value=28
DemoDicSort, key=January, value=31
DemoDicSort, key=July, value=31
DemoDicSort, key=June, value=30
DemoDicSort, key=March, value=31
DemoDicSort, key=May, value=31
DemoDicSort, key=November, value=30
DemoDicSort, key=October, value=31
DemoDicSort, key=September, value=30
*/
    }
}
